package net.jingkao.app.common;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

/**
 * HTTP调用返回
 * @author chao
 *
 */
public class HttpResponse {
	
	private byte[] data;
	
	
	public HttpResponse(byte[] data){
		this.data = data;
	}
	
	public byte[] getAsBytes(){
		return data;
	}
	
	public String getAsString(){
		return new String(data);
	}
	
	public JsonObject getAsJson(){
		String jsonStr = getAsString();
		return new JsonParser().parse(jsonStr).getAsJsonObject();
	}

}
